//Accepted
#include <cstdio>
#include <cmath>

int t, x, y;

int main(){
	//freopen("in.txt","r",stdin);//freopen("out.txt","w",stdout);
	scanf("%d", &t);
	while(t--){
		scanf("%d%d", &x, &y);
		printf("%d\n", ((int)ceil(x/3))*((int)ceil(y/3)) );
	}
	return 0;
}
